package com.xique.api.controller;

import com.xique.api.bean.request.device.DeviceAddRequest;
import com.xique.api.bean.request.device.DeviceListRequest;
import com.xique.api.service.biz.service.IDeviceBizService;
import com.xique.common.core.web.controller.BaseController;
import com.xique.common.core.web.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author shd
 * @create 2022/3/10 19:13
 */
@RestController
@RequestMapping("/device")
public class DeviceController extends BaseController {

    @Autowired
    private IDeviceBizService deviceBizService;

    @PostMapping("/v1/list")
    public AjaxResult list(@RequestBody DeviceListRequest request) {
        return deviceBizService.getDeviceList(request);
    }

    public AjaxResult add(@Valid @RequestBody DeviceAddRequest request) {
        return deviceBizService.addDevice(request);
    }
}
